<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script type="text/javascript">
<!--编写一个JavaScript对象-->
    var user = {
        name:"ccb",
        age:23,
        id:1
    };

    console.log(user);

    //从JavaScript对象转换成JSON字符串
    var json = JSON.stringify(user);
    console.log(json);

    console.log("==========================")

    //JSON字符串转换成JavaScript对象
    var obj = JSON.parse(json);
    console.log(obj);
    </script>
</head>
<body>


</body>
</html>